package com.example.mongo.service;

import com.example.mongo.Model.bean.Chapter;
import com.example.mongo.Model.bean.Content;
import com.example.mongo.dao.ChapterMapper;
import com.example.mongo.dao.ContentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;
@CacheConfig(cacheNames = "content")
@Service
public class ContentService {

    @Autowired
    public ContentMapper contentMapper;

    @Cacheable
    public List<Content> getContentByChapterId(int chapterId){
        return  contentMapper.getContentByChapterId(chapterId);
    }
}
